package view;

import javax.swing.JPanel;
import javax.swing.JFrame;
import java.awt.Toolkit;
import java.awt.Dimension;
import java.awt.Rectangle;
import javax.swing.JLabel;
import java.awt.Point;
import java.awt.Font;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.SwingConstants;
import javax.swing.ImageIcon;
import javax.swing.BorderFactory;
import javax.swing.border.TitledBorder;
import javax.swing.JComboBox;

import common.loadData;

public class addCrame extends JFrame {

	private static final long serialVersionUID = 1L;
	private JPanel jContentPane = null;
	private JPanel panelTitle = null;
	private JLabel lbtitle = null;
	private JButton btnCancel = null;
	private JLabel LabelChooseCrime = null;
	private JLabel LabelChooseCrame = null;
	private JLabel LabelChooseHistory = null;
	private JLabel LabelChooseComplaint = null;
	private JComboBox ComboBoxChooseCriminal = null;
	private JComboBox ComboBoxChooseCrame = null;
	private JComboBox ComboBoxChooseHistory = null;
	private JComboBox ComboBoxChooseComplaint = null;
	private JButton btnSave = null;
	private JButton btnExit = null;

	public addCrame() {
		super();
		initialize();
	}

	private void initialize() {
		this.setSize(439, 337);
		this.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/image/List.png")));
		this.setResizable(false);
		this.setContentPane(getJContentPane());
		this.setTitle("Add Crame");
	}

	private JPanel getJContentPane() {
		if (jContentPane == null) {
			LabelChooseComplaint = new JLabel();
			LabelChooseComplaint.setBounds(new Rectangle(45, 198, 115, 27));
			LabelChooseComplaint.setText("Choose Complaint:");
			LabelChooseHistory = new JLabel();
			LabelChooseHistory.setBounds(new Rectangle(45, 150, 106, 32));
			LabelChooseHistory.setText("Choose History:");
			LabelChooseCrame = new JLabel();
			LabelChooseCrame.setBounds(new Rectangle(45, 105, 105, 30));
			LabelChooseCrame.setText("Choose Crame:");
			LabelChooseCrime = new JLabel();
			LabelChooseCrime.setText("Choose Criminal:");
			LabelChooseCrime.setLocation(new Point(45, 59));
			LabelChooseCrime.setSize(new Dimension(99, 31));
			jContentPane = new JPanel();
			jContentPane.setLayout(null);
			jContentPane.add(getPanelTitle(), null);
			jContentPane.add(LabelChooseCrime, null);
			jContentPane.add(LabelChooseCrame, null);
			jContentPane.add(LabelChooseHistory, null);
			jContentPane.add(LabelChooseComplaint, null);
			jContentPane.add(getComboBoxChooseCriminal(), null);
			jContentPane.add(getComboBoxChooseCrame(), null);
			jContentPane.add(getComboBoxChooseHistory(), null);
			jContentPane.add(getComboBoxChooseComplaint(), null);
			jContentPane.add(getBtnSave(), null);
			jContentPane.add(getBtnExit(), null);
		}
		return jContentPane;
	}

	private JPanel getPanelTitle() {
		if (panelTitle == null) {
			lbtitle = new JLabel();
			lbtitle.setLocation(new Point(0, 0));
			lbtitle.setFont(new Font("Dialog", Font.BOLD, 18));
			lbtitle.setForeground(new Color(46, 130, 124));
			lbtitle.setText("Add Crame");
			lbtitle.setSize(new Dimension(102, 27));
			panelTitle = new JPanel();
			panelTitle.setLayout(null);
			panelTitle.setBounds(new Rectangle(164, 17, 102, 26));
			panelTitle.setBorder(BorderFactory.createTitledBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, Color.red), "", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));
			panelTitle.add(lbtitle, null);
			panelTitle.add(getBtnCancel(), null);
		}
		return panelTitle;
	}

	private JButton getBtnCancel() {
		if (btnCancel == null) {
			btnCancel = new JButton();
			btnCancel.setBounds(new Rectangle(5, 32, 83, 34));
			btnCancel.setHorizontalTextPosition(SwingConstants.RIGHT);
			btnCancel.setIcon(new ImageIcon(getClass().getResource("/image/Close.png")));
			btnCancel.setText("Exit");
			btnCancel.setHorizontalAlignment(SwingConstants.LEFT);
		}
		return btnCancel;
	}

	private JComboBox getComboBoxChooseCriminal() {
		if (ComboBoxChooseCriminal == null) {
			ComboBoxChooseCriminal = new JComboBox();
			ComboBoxChooseCriminal.setLocation(new Point(179, 61));
			ComboBoxChooseCriminal.setSize(new Dimension(197, 26));
		}
		return ComboBoxChooseCriminal;
	}

	private JComboBox getComboBoxChooseCrame() {
		if (ComboBoxChooseCrame == null) {
			ComboBoxChooseCrame = new JComboBox();
			ComboBoxChooseCrame.setLocation(new Point(179, 106));
			ComboBoxChooseCrame.setSize(new Dimension(197, 26));
		}
		return ComboBoxChooseCrame;
	}

	private JComboBox getComboBoxChooseHistory() {
		if (ComboBoxChooseHistory == null) {
			ComboBoxChooseHistory = new JComboBox();
			ComboBoxChooseHistory.setLocation(new Point(180, 152));
			ComboBoxChooseHistory.setSize(new Dimension(197, 26));
		}
		return ComboBoxChooseHistory;
	}

	private JComboBox getComboBoxChooseComplaint() {
		if (ComboBoxChooseComplaint == null) {
			ComboBoxChooseComplaint = new JComboBox();
			ComboBoxChooseComplaint.setLocation(new Point(179, 198));
			ComboBoxChooseComplaint.setSize(new Dimension(197, 26));
		}
		return ComboBoxChooseComplaint;
	}

	private JButton getBtnSave() {
		if (btnSave == null) {
			btnSave = new JButton();
			btnSave.setHorizontalTextPosition(SwingConstants.RIGHT);
			btnSave.setIcon(new ImageIcon(getClass().getResource("/image/Save.png")));
			btnSave.setText("Save");
			btnSave.setSize(new Dimension(90, 32));
			btnSave.setLocation(new Point(139, 254));
			btnSave.setHorizontalAlignment(SwingConstants.LEFT);
		}
		return btnSave;
	}

	private JButton getBtnExit() {
		if (btnExit == null) {
			btnExit = new JButton();
			btnExit.setHorizontalTextPosition(SwingConstants.RIGHT);
			btnExit.setIcon(new ImageIcon(getClass().getResource("/image/Close.png")));
			btnExit.setText("Exit");
			btnExit.setLocation(new Point(284, 254));
			btnExit.setSize(new Dimension(89, 32));
			btnExit.setHorizontalAlignment(SwingConstants.LEFT);
			btnExit.addActionListener(new ActionListener() {
				
				@Override
				public void actionPerformed(ActionEvent e) {
					loadData.tab=2;
					mainForm a = new mainForm();
					a.setVisible(true);	
					dispose();
					
				}
			});
		}
		return btnExit;
	}

}
